<template>
  <el-row>
    <el-divider v-if="index !== 0"></el-divider>
    <el-row>
      <el-col :span="4">
        <el-image
          style="width:40px; height: 40px"
          :src="`${images}/${dynamicItem.imgUrl}`"
          fit="cover"
        ></el-image>
      </el-col>
      <el-col :span="20">
        <el-row class="info">
          <el-col :span="8" class="author">
            <nuxt-link :to="`/author/${dynamicItem.author.id}/dynamic`">{{
              dynamicItem.author.name
            }}</nuxt-link>
          </el-col>
          <el-col :span="4"><span class="smaill_title">投稿了</span></el-col>
          <el-col :span="12" class="time smaill_title">{{
            dynamicItem.time
          }}</el-col>
        </el-row>
        <el-row class="title">
          <nuxt-link :to="`/news/${dynamicItem.id}`">{{
            dynamicItem.title
          }}</nuxt-link>
          to
        </el-row>
      </el-col>
    </el-row>
  </el-row>
</template>

<script>
import { IMAGES } from '@/assets/js/settings'
export default {
  props: {
    dynamicItem: {
      type: Object,
      default: () => {
        return {
          id: '',
          title: '',
          imgUrl: '',
          time: '',
          author: {}
        }
      }
    },
    index: {
      type: Number,
      default: 0
    }
  },
  computed: {
    images() {
      return IMAGES
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  font-size: 14px;
  overflow: hidden; /*超出的文本隐藏*/
  text-overflow: ellipsis; /*溢出用省略号显示*/
  white-space: nowrap; /*溢出不换行*/
}
.info {
  height: 20px;
  .el-col {
    height: 100%;
    @include flexCenter($jc: flex-start);
  }
  .time {
    justify-content: flex-end;
  }
}
.author {
  overflow: hidden;
}
a {
  color: #333;
  text-decoration: none;
  &:hover {
    color: $--color-primary;
  }
}
.smaill_title {
  font-size: 12px;
  color: #999;
}
/deep/ .el-divider--horizontal {
  margin: 8px 0px;
}
</style>
